home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / apply.doc < prev    next >
Text File  |  1995-03-31  |  661b  |  24 lines

  1. Author: [William C Wickes] 
  2.   Date: Thu Apr 11 1991 
  3.  
  4. Given x and F on the stack, where x is any argument, and F is a 
  5. function of one argument (user-defined or built-in), the following 
  6. program returns 'F(x)': 
  7.  
  8. %%HP: T(3)A(R)F(.); 
  9. @ x F -> 'F(x)' 
  10. \<< SWAP -> a 
  11.    \<< 'a' SWAP EVAL                   @ 'F(a)' 
  12.        'a' a 2 \->LIST \|^MATCH DROP   @ 'F(x)' 
  13.    \>> 
  14. \>> 
  15.  
  16. To put a built-in function F on the stack, execute { F } 1 GET.  You 
  17. can also build this logic into the program above, and use { F } as the 
  18. argument. 
  19.  
  20. For user-defined functions, you also can use SWAP 1 \->LIST SWAP APPLY. 
  21.  
  22. Bill Wickes 
  23. HP Corvallis 
  24.